using System;
using System.Collections;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;

using WHC.Pager.Entity;
using Microsoft.Practices.EnterpriseLibrary.Data;
using WHC.Hotel.Entity;
using WHC.Hotel.IDAL;
using WHC.OrderWater.Commons;

namespace WHC.Hotel.DAL
{
	/// <summary>
	/// TeaSuiteBill 的摘要说明。
	/// </summary>
	public class KTVSuiteBill : BaseDAL<KTVSuiteBillInfo>, IKTVSuiteBill
	{
		#region 对象实例及构造函数

		public static KTVSuiteBill Instance
		{
			get
			{
				return new KTVSuiteBill();
			}
		}
		public KTVSuiteBill() : base("YL_KTVSuiteBill","ID")
		{
		}

		#endregion

		/// <summary>
		/// 将DataReader的属性值转化为实体类的属性值，返回实体类
		/// </summary>
		/// <param name="dr">有效的DataReader对象</param>
		/// <returns>实体类对象</returns>
		protected override KTVSuiteBillInfo DataReaderToEntity(IDataReader dataReader)
		{
			KTVSuiteBillInfo teaSuiteBillInfo = new KTVSuiteBillInfo();
			SmartDataReader reader = new SmartDataReader(dataReader);
			
			teaSuiteBillInfo.ID = reader.GetInt32("ID");
			teaSuiteBillInfo.BillNumber = reader.GetString("BillNumber");
			teaSuiteBillInfo.RoomNo = reader.GetString("RoomNo");
			teaSuiteBillInfo.CustomerName = reader.GetString("CustomerName");
			teaSuiteBillInfo.Deposit = reader.GetDecimal("Deposit");
			teaSuiteBillInfo.Consumption = reader.GetDecimal("Consumption");
			teaSuiteBillInfo.OfferMoney = reader.GetDecimal("OfferMoney");
			teaSuiteBillInfo.PayMoney = reader.GetDecimal("PayMoney");
            teaSuiteBillInfo.ReceivedMoney = reader.GetDecimal("ReceivedMoney");
			teaSuiteBillInfo.KeepChange = reader.GetDecimal("KeepChange");
			teaSuiteBillInfo.Creator = reader.GetString("Creator");
			teaSuiteBillInfo.PayType = reader.GetString("PayType");
			teaSuiteBillInfo.Cash = reader.GetDecimal("Cash");
			teaSuiteBillInfo.Card = reader.GetDecimal("Card");
			teaSuiteBillInfo.CardNumber = reader.GetString("CardNumber");
			teaSuiteBillInfo.DaijinTicket = reader.GetDecimal("DaijinTicket");
			teaSuiteBillInfo.NationalCredit = reader.GetDecimal("NationalCredit");
			teaSuiteBillInfo.CreditCardNumber = reader.GetString("CreditCardNumber");
			teaSuiteBillInfo.InterCredit = reader.GetDecimal("InterCredit");
			teaSuiteBillInfo.InterCreditCardNumber = reader.GetString("InterCreditCardNumber");
			teaSuiteBillInfo.Invoice = reader.GetBoolean("Invoice");
			teaSuiteBillInfo.CreateDate = reader.GetDateTime("CreateDate");
			teaSuiteBillInfo.InHotelDate = reader.GetDateTime("InHotelDate");
			teaSuiteBillInfo.CheckStatus = reader.GetString("CheckStatus");
			teaSuiteBillInfo.Note = reader.GetString("Note");
			
			return teaSuiteBillInfo;
		}

		/// <summary>
		/// 将实体对象的属性值转化为Hashtable对应的键值
		/// </summary>
		/// <param name="obj">有效的实体对象</param>
		/// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(KTVSuiteBillInfo obj)
		{
		    KTVSuiteBillInfo info = obj as KTVSuiteBillInfo;
			Hashtable hash = new Hashtable(); 
			
 			hash.Add("BillNumber", info.BillNumber);
 			hash.Add("RoomNo", info.RoomNo);
 			hash.Add("CustomerName", info.CustomerName);
 			hash.Add("Deposit", info.Deposit);
 			hash.Add("Consumption", info.Consumption);
 			hash.Add("OfferMoney", info.OfferMoney);
 			hash.Add("PayMoney", info.PayMoney);
            hash.Add("ReceivedMoney", info.ReceivedMoney);
 			hash.Add("KeepChange", info.KeepChange);
 			hash.Add("Creator", info.Creator);
 			hash.Add("PayType", info.PayType);
 			hash.Add("Cash", info.Cash);
 			hash.Add("Card", info.Card);
 			hash.Add("CardNumber", info.CardNumber);
 			hash.Add("DaijinTicket", info.DaijinTicket);
 			hash.Add("NationalCredit", info.NationalCredit);
 			hash.Add("CreditCardNumber", info.CreditCardNumber);
 			hash.Add("InterCredit", info.InterCredit);
 			hash.Add("InterCreditCardNumber", info.InterCreditCardNumber);
 			hash.Add("Invoice", info.Invoice);
 			hash.Add("CreateDate", info.CreateDate);
 			hash.Add("InHotelDate", info.InHotelDate);
 			hash.Add("CheckStatus", info.CheckStatus);
 			hash.Add("Note", info.Note);
 				
			return hash;
		}

    }
}